<?php
class Pages_Model extends ORM {
	
	protected $table_name = 'pages';
	protected $primary_key = 'pages_id';
	protected $col_sort_order = 'pages_sort_order';
	protected $col_pages_status = 'pages_status';
	protected $sorting = array('pages_update_date' => 'desc');
	
	public function get()
	{
		$this->db->from($this->table_name);
		$this->db->select('*');
		$this->db->orderby($this->col_sort_order,'desc');
		$this->db->orderby($this->primary_key,'desc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_with_active($language)
	{
		$this->db->select('*');
		$this->db->from($this->table_name);
		$this->db->join('pages_content', 'pages_content.pages_id', 'pages.pages_id');
		$this->db->where('pages_content.languages_id',$language);
		$this->db->where($this->col_pages_status,'1');
		$this->db->orderby('pages.'.$this->col_sort_order,'desc');
		$this->db->orderby('pages.'.$this->primary_key,'desc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
}
?>